<template>
  <div class="about">
    <h1>This is an about page</h1>
    <form action="http://127.0.0.1:8080/user" method="post">
      <input type="file" name="pic">
      <button type="submit"></button>
    </form>
  </div>
</template>
<script>
export default {
  data() {
    return {
      
    }
  },
  created() {
    // 类
    class a {
      constructor(val){
        console.log('fatherClass success!!!')
      }
      test(){
        console.log('father')
      }
      static test1(){
        console.log('fatherClass')
      }
    }
    class b extends a {
      // 如果子类继承没有构造函数则不需要super，super只能在子类的构造函数中
      constructor(){
        super()
        // super正常指向父类的原型对象
        super.test()
        console.log(arguments)
      }
      happy(){
        console.log('happy')
      }
      // super在静态函数中则表示父对象a
      static happy1(){
        super.test1()
      }
    }
    let c = new b(1) // 构建也会调用父对象的构造函数
    c.happy()
    b.happy1()

    // 柯里化
    var foo = function(x){
      return function(y){
        return x + y
      }
    }
    console.log(foo(3)(4))

    // 闭包
    function f(){
      var a = 4
      var b = 3
      return function (){
        return a + b
      }
    }
    console.log(f()());

    // Generator函数
    function* gen(x){
      let f = yield x + 1
      let y = yield f + 2
    }
    let g = gen(2)
    console.log(g.next())
    console.log(g.next())

    // ES6去重
    let arr = [1,2,3,2,2,4,5,3,3,6,4,7,7,8,5,6,9]
    let unique = (array) => [ ...new Set(array)]
    console.log(unique(arr))
  }
}
</script>
